diff options
44 files changed, 709 insertions, 518 deletions
diff --git a/api/file.go b/api/file.go index 5dc1db650..bb9aa00d8 100644 --- a/api/file.go +++ b/api/file.go @@ -23,7 +23,6 @@ import ( "image/jpeg" "io" "io/ioutil" - "mime" "net/http" "net/url" "os" @@ -407,7 +406,7 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", "max-age=2592000, public") w.Header().Set("Content-Length", strconv.Itoa(len(f))) - w.Header().Set("Content-Type", mime.TypeByExtension(filepath.Ext(filename))) + w.Header().Del("Content-Type") // Content-Type will be set automatically by the http writer // attach extra headers to trigger a download on IE and Edge ua := user_agent.New(r.UserAgent()) diff --git a/api/user.go b/api/user.go index 2d7dd9ab1..78f8768a4 100644 --- a/api/user.go +++ b/api/user.go @@ -991,7 +991,7 @@ func updateRoles(c *Context, w http.ResponseWriter, r *http.Request) { } if model.IsInRole(new_roles, model.ROLE_SYSTEM_ADMIN) && !c.IsSystemAdmin() { - c.Err = model.NewAppError("updateRoles", "The system_admin role can only be set by another system admin", "") + c.Err = model.NewAppError("updateRoles", "The system admin role can only be set by another system admin", "") c.Err.StatusCode = http.StatusForbidden return } @@ -1014,6 +1014,12 @@ func updateRoles(c *Context, w http.ResponseWriter, r *http.Request) { return } + if user.IsInRole(model.ROLE_SYSTEM_ADMIN) && !c.IsSystemAdmin() { + c.Err = model.NewAppError("updateRoles", "The system admin role can only by modified by another system admin", "") + c.Err.StatusCode = http.StatusForbidden + return + } + ruser := UpdateRoles(c, user, new_roles) if c.Err != nil { return diff --git a/config/config.json b/config/config.json index b14175372..88da33215 100644 --- a/config/config.json +++ b/config/config.json @@ -89,4 +89,4 @@ "TokenEndpoint": "", "UserApiEndpoint": "" } -} +}
\ No newline at end of file diff --git a/doc/README.md b/doc/README.md index d711b5d53..4c7c4cc0e 100644 --- a/doc/README.md +++ b/doc/README.md @@ -19,6 +19,7 @@ - [Code Contribution Guidelines](developer/Code-Contribution-Guidelines.md) - [Developer Machine Setup](developer/Setup.md) - [Mattermost Style Guide](developer/Style-Guide.md) +- [API Overview](api/Overview.md) ## Usage Help diff --git a/doc/api/Overview.md b/doc/api/Overview.md new file mode 100644 index 000000000..02e11974e --- /dev/null +++ b/doc/api/Overview.md @@ -0,0 +1,94 @@ +# API Overview + +This provides a basic overview of the Mattermost API. All examples assume there is a Mattermost instance running at http://localhost:8065. + +## Schema + +All API access is done through `yourdomain.com/api/v1/`, with all data being sent and received as JSON. + + +## Authentication + +The majority of the Mattermost API involves interacting with teams. Therefore, most API methods require authentication as a user. There are two ways to authenticate into a Mattermost system. + +##### Session Token + +Make an HTTP POST to `yourdomain.com/api/v1/users/login` with a JSON body indicating the `name` of the team, the user's `email` and `password`. + +``` +curl -i -d '{"name":"exampleteam","email":"someone@nowhere.com","password":"thisisabadpassword"}' http://localhost:8065/api/v1/users/login +``` + +If successful, the response will contain a `Token` header and a User object in the body. + +``` +HTTP/1.1 200 OK +Set-Cookie: MMSID=hyr5dmb1mbb49c44qmx4whniso; Path=/; Max-Age=2592000; HttpOnly +Token: hyr5dmb1mbb49c44qmx4whniso +X-Ratelimit-Limit: 10 +X-Ratelimit-Remaining: 9 +X-Ratelimit-Reset: 1 +X-Request-Id: smda55ckcfy89b6tia58shk5fh +X-Version-Id: developer +Date: Fri, 11 Sep 2015 13:21:14 GMT +Content-Length: 657 +Content-Type: application/json; charset=utf-8 + +{{user object as json}} +``` + +Include the `Token` as part of the `Authentication` header on your future API requests with the `Bearer` method. + +``` +curl -i -H 'Authorization: Bearer hyr5dmb1mbb49c44qmx4whniso' http://localhost:8065/api/v1/users/me +``` + +That's it! You should now be able to access the API as the user you logged in as. + +##### OAuth2 + +Coming soon... + + +## Client Errors + +All errors will return an appropriate HTTP response code along with the following JSON body: + +``` +{ + "message": "", // the reason for the error + "detailed_error": "", // some extra details about the error + "request_id": "", // the ID of the request + "status_code": 0 // the HTTP status code +} +``` + + +## Rate Limiting + +Whenever you make an HTTP request to the Mattermost API you might notice the following headers included in the response: +``` +X-Ratelimit-Limit: 10 +X-Ratelimit-Remaining: 9 +X-Ratelimit-Reset: 1441983590 + +``` + +These headers are telling you your current rate limit status. + +Header | Description +--------------------- | ----------- +X-Ratelimit-Limit | The maximum number of requests you can make per second. +X-Ratelimit-Remaining | The number of requests remaining in the current window. +X-Ratelimit-Reset | The remaining UTC epoch seconds before the rate limit resets. + +If you exceed your rate limit for a window you will receive the following error in the body of the response: +``` +HTTP/1.1 429 Too Many Requests +Date: Tue, 10 Sep 2015 11:20:28 GMT +X-RateLimit-Limit: 10 +X-RateLimit-Remaining: 0 +X-RateLimit-Reset: 1 + +limit exceeded +``` diff --git a/doc/install/Production-Ubuntu.md b/doc/install/Production-Ubuntu.md index 0f1373c1a..05a56c412 100644 --- a/doc/install/Production-Ubuntu.md +++ b/doc/install/Production-Ubuntu.md @@ -8,7 +8,7 @@ ## Set up Database Server 1. For the purposes of this guide we will assume this server has an IP address of 10.10.10.1 -1. Install PostgreSQL 9.3+ (or MySQL 5.2+) +1. Install PostgreSQL 9.3+ (or MySQL 5.6+) * ``` sudo apt-get install postgresql postgresql-contrib``` 1. PostgreSQL created a user account called `postgres`. You will need to log into that account with: * ``` sudo -i -u postgres``` diff --git a/doc/integrations/webhooks/Incoming.md b/doc/integrations/webhooks/Incoming.md index 6e25f182e..0814eb420 100644 --- a/doc/integrations/webhooks/Incoming.md +++ b/doc/integrations/webhooks/Incoming.md @@ -56,7 +56,7 @@ payload={"channel": "off-topic", "text": "Hello, this is some text."} Combining everything above, here is an example message made using a curl command: ``` -curl -i -X POST 'payload={"channel": "off-topic", "text": "Hello, this is some text."}' http://yourmattermost.com/hooks/xxxxxxxxxxxxxxxxxxxxxxxxxx +curl -i -X POST -d 'payload={"channel": "off-topic", "text": "Hello, this is some text."}' http://yourmattermost.com/hooks/xxxxxxxxxxxxxxxxxxxxxxxxxx ``` A post with that text will be made to the Off-Topic channel. diff --git a/store/sql_post_store.go b/store/sql_post_store.go index 668f45fbb..8d62eaad0 100644 --- a/store/sql_post_store.go +++ b/store/sql_post_store.go @@ -396,6 +396,17 @@ func (s SqlPostStore) getParentsPosts(channelId string, offset int, limit int) S return storeChannel } +var specialSearchChar = []string{ + "<", + ">", + "+", + "-", + "(", + ")", + "~", + "@", +} + func (s SqlPostStore) Search(teamId string, userId string, terms string, isHashtagSearch bool) StoreChannel { storeChannel := make(StoreChannel) @@ -411,10 +422,10 @@ func (s SqlPostStore) Search(teamId string, userId string, terms string, isHasht } } - // @ has a speical meaning in INNODB FULLTEXT indexes and - // is reserved for calc'ing distances so you - // cannot escape it so we replace it. - terms = strings.Replace(terms, "@", " ", -1) + // these chars have speical meaning and can be treated as spaces + for _, c := range specialSearchChar { + terms = strings.Replace(terms, c, " ", -1) + } var posts []*model.Post diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go index 6a6364dc8..62d7b0100 100644 --- a/store/sql_post_store_test.go +++ b/store/sql_post_store_test.go @@ -516,7 +516,7 @@ func TestPostStoreSearch(t *testing.T) { o4.ChannelId = c1.Id o4.UserId = model.NewId() o4.Hashtags = "#hashtag" - o4.Message = "message" + o4.Message = "(message)blargh" o4 = (<-store.Post().Save(o4)).Data.(*model.Post) o5 := &model.Post{} @@ -527,37 +527,37 @@ func TestPostStoreSearch(t *testing.T) { r1 := (<-store.Post().Search(teamId, userId, "corey", false)).Data.(*model.PostList) if len(r1.Order) != 1 && r1.Order[0] != o1.Id { - t.Fatal("returned wrong serach result") + t.Fatal("returned wrong search result") } r3 := (<-store.Post().Search(teamId, userId, "new", false)).Data.(*model.PostList) if len(r3.Order) != 2 && r3.Order[0] != o1.Id { - t.Fatal("returned wrong serach result") + t.Fatal("returned wrong search result") } r4 := (<-store.Post().Search(teamId, userId, "john", false)).Data.(*model.PostList) if len(r4.Order) != 1 && r4.Order[0] != o2.Id { - t.Fatal("returned wrong serach result") + t.Fatal("returned wrong search result") } r5 := (<-store.Post().Search(teamId, userId, "matter*", false)).Data.(*model.PostList) if len(r5.Order) != 1 && r5.Order[0] != o1.Id { - t.Fatal("returned wrong serach result") + t.Fatal("returned wrong search result") } r6 := (<-store.Post().Search(teamId, userId, "#hashtag", true)).Data.(*model.PostList) if len(r6.Order) != 1 && r6.Order[0] != o4.Id { - t.Fatal("returned wrong serach result") + t.Fatal("returned wrong search result") } r7 := (<-store.Post().Search(teamId, userId, "#secret", true)).Data.(*model.PostList) if len(r7.Order) != 1 && r7.Order[0] != o5.Id { - t.Fatal("returned wrong serach result") + t.Fatal("returned wrong search result") } r8 := (<-store.Post().Search(teamId, userId, "@thisshouldmatchnothing", true)).Data.(*model.PostList) if len(r8.Order) != 0 { - t.Fatal("returned wrong serach result") + t.Fatal("returned wrong search result") } r9 := (<-store.Post().Search(teamId, userId, "mattermost jersey", false)).Data.(*model.PostList) @@ -569,4 +569,14 @@ func TestPostStoreSearch(t *testing.T) { if len(r10.Order) != 2 { t.Fatal("returned wrong search result") } + + r11 := (<-store.Post().Search(teamId, userId, "message blargh", false)).Data.(*model.PostList) + if len(r11.Order) != 1 { + t.Fatal("returned wrong search result") + } + + r12 := (<-store.Post().Search(teamId, userId, "blargh>", false)).Data.(*model.PostList) + if len(r12.Order) != 1 { + t.Fatal("returned wrong search result") + } } diff --git a/utils/config.go b/utils/config.go index 44c4c43af..90e44259a 100644 --- a/utils/config.go +++ b/utils/config.go @@ -179,6 +179,8 @@ func getClientProperties(c *model.Config) map[string]string { props["BuildHash"] = model.BuildHash props["SiteName"] = c.TeamSettings.SiteName + props["EnableTeamCreation"] = strconv.FormatBool(c.TeamSettings.EnableTeamCreation) + props["EnableOAuthServiceProvider"] = strconv.FormatBool(c.ServiceSettings.EnableOAuthServiceProvider) props["SegmentDeveloperKey"] = c.ServiceSettings.SegmentDeveloperKey diff --git a/web/react/components/activity_log_modal.jsx b/web/react/components/activity_log_modal.jsx index aee2541b5..ff370c32e 100644 --- a/web/react/components/activity_log_modal.jsx +++ b/web/react/components/activity_log_modal.jsx @@ -31,6 +31,11 @@ export default class ActivityLogModal extends React.Component { } submitRevoke(altId, e) { e.preventDefault(); + var modalContent = $(e.target).closest('.modal-content'); + modalContent.addClass('animation--highlight'); + setTimeout(() => { + modalContent.removeClass('animation--highlight'); + }, 1500); Client.revokeSession(altId, function handleRevokeSuccess() { AsyncClient.getSessions(); diff --git a/web/react/components/admin_console/admin_controller.jsx b/web/react/components/admin_console/admin_controller.jsx index 92f0bbdce..f40e48f70 100644 --- a/web/react/components/admin_console/admin_controller.jsx +++ b/web/react/components/admin_console/admin_controller.jsx @@ -147,7 +147,7 @@ export default class AdminController extends React.Component { } return ( - <div className='container-fluid'> + <div> <div className='sidebar--menu' id='sidebar-menu' diff --git a/web/react/components/admin_console/admin_sidebar.jsx b/web/react/components/admin_console/admin_sidebar.jsx index 4b9ff3cb8..f102661b2 100644 --- a/web/react/components/admin_console/admin_sidebar.jsx +++ b/web/react/components/admin_console/admin_sidebar.jsx @@ -129,141 +129,143 @@ export default class AdminSidebar extends React.Component { <div className='sidebar--left sidebar--collapsable'> <div> <AdminSidebarHeader /> - <ul className='nav nav-pills nav-stacked'> - <li> - <ul className='nav nav__sub-menu'> - <li> - <h4> - <span className='icon fa fa-gear'></span> - <span>{'SETTINGS'}</span> - </h4> - </li> - </ul> - <ul className='nav nav__sub-menu padded'> - <li> - <a - href='#' - className={this.isSelected('service_settings')} - onClick={this.handleClick.bind(this, 'service_settings', null)} - > - {'Service Settings'} - </a> - </li> - <li> - <a - href='#' - className={this.isSelected('team_settings')} - onClick={this.handleClick.bind(this, 'team_settings', null)} - > - {'Team Settings'} - </a> - </li> - <li> - <a - href='#' - className={this.isSelected('sql_settings')} - onClick={this.handleClick.bind(this, 'sql_settings', null)} - > - {'SQL Settings'} - </a> - </li> - <li> - <a - href='#' - className={this.isSelected('email_settings')} - onClick={this.handleClick.bind(this, 'email_settings', null)} - > - {'Email Settings'} - </a> - </li> - <li> - <a - href='#' - className={this.isSelected('image_settings')} - onClick={this.handleClick.bind(this, 'image_settings', null)} - > - {'File Settings'} - </a> - </li> - <li> - <a - href='#' - className={this.isSelected('log_settings')} - onClick={this.handleClick.bind(this, 'log_settings', null)} - > - {'Log Settings'} - </a> - </li> - <li> - <a - href='#' - className={this.isSelected('rate_settings')} - onClick={this.handleClick.bind(this, 'rate_settings', null)} - > - {'Rate Limit Settings'} - </a> - </li> - <li> - <a - href='#' - className={this.isSelected('privacy_settings')} - onClick={this.handleClick.bind(this, 'privacy_settings', null)} - > - {'Privacy Settings'} - </a> - </li> - <li> - <a - href='#' - className={this.isSelected('gitlab_settings')} - onClick={this.handleClick.bind(this, 'gitlab_settings', null)} - > - {'GitLab Settings'} - </a> - </li> - </ul> - <ul className='nav nav__sub-menu'> - <li> - <h4> - <span className='icon fa fa-gear'></span> - <span>{'TEAMS (' + count + ')'}</span> - <span className='menu-icon--right'> - <a - href='#' - onClick={this.showTeamSelect} - > - <i className='fa fa-plus'></i> - </a> - </span> - </h4> - </li> - </ul> - <ul className='nav nav__sub-menu padded'> - <li> - {teams} - </li> - </ul> - <ul className='nav nav__sub-menu'> - <li> - <h4> - <span className='icon fa fa-gear'></span> - <span>{'OTHER'}</span> - </h4> - </li> - </ul> - <ul className='nav nav__sub-menu padded'> - <li> - <a - href='#' - className={this.isSelected('logs')} - onClick={this.handleClick.bind(this, 'logs', null)} - > - {'Logs'} - </a> - </li> - </ul> - </li> - </ul> + <div className='nav-pills__container'> + <ul className='nav nav-pills nav-stacked'> + <li> + <ul className='nav nav__sub-menu'> + <li> + <h4> + <span className='icon fa fa-gear'></span> + <span>{'SETTINGS'}</span> + </h4> + </li> + </ul> + <ul className='nav nav__sub-menu padded'> + <li> + <a + href='#' + className={this.isSelected('service_settings')} + onClick={this.handleClick.bind(this, 'service_settings', null)} + > + {'Service Settings'} + </a> + </li> + <li> + <a + href='#' + className={this.isSelected('team_settings')} + onClick={this.handleClick.bind(this, 'team_settings', null)} + > + {'Team Settings'} + </a> + </li> + <li> + <a + href='#' + className={this.isSelected('sql_settings')} + onClick={this.handleClick.bind(this, 'sql_settings', null)} + > + {'SQL Settings'} + </a> + </li> + <li> + <a + href='#' + className={this.isSelected('email_settings')} + onClick={this.handleClick.bind(this, 'email_settings', null)} + > + {'Email Settings'} + </a> + </li> + <li> + <a + href='#' + className={this.isSelected('image_settings')} + onClick={this.handleClick.bind(this, 'image_settings', null)} + > + {'File Settings'} + </a> + </li> + <li> + <a + href='#' + className={this.isSelected('log_settings')} + onClick={this.handleClick.bind(this, 'log_settings', null)} + > + {'Log Settings'} + </a> + </li> + <li> + <a + href='#' + className={this.isSelected('rate_settings')} + onClick={this.handleClick.bind(this, 'rate_settings', null)} + > + {'Rate Limit Settings'} + </a> + </li> + <li> + <a + href='#' + className={this.isSelected('privacy_settings')} + onClick={this.handleClick.bind(this, 'privacy_settings', null)} + > + {'Privacy Settings'} + </a> + </li> + <li> + <a + href='#' + className={this.isSelected('gitlab_settings')} + onClick={this.handleClick.bind(this, 'gitlab_settings', null)} + > + {'GitLab Settings'} + </a> + </li> + </ul> + <ul className='nav nav__sub-menu'> + <li> + <h4> + <span className='icon fa fa-gear'></span> + <span>{'TEAMS (' + count + ')'}</span> + <span className='menu-icon--right'> + <a + href='#' + onClick={this.showTeamSelect} + > + <i className='fa fa-plus'></i> + </a> + </span> + </h4> + </li> + </ul> + <ul className='nav nav__sub-menu padded'> + <li> + {teams} + </li> + </ul> + <ul className='nav nav__sub-menu'> + <li> + <h4> + <span className='icon fa fa-gear'></span> + <span>{'OTHER'}</span> + </h4> + </li> + </ul> + <ul className='nav nav__sub-menu padded'> + <li> + <a + href='#' + className={this.isSelected('logs')} + onClick={this.handleClick.bind(this, 'logs', null)} + > + {'Logs'} + </a> + </li> + </ul> + </li> + </ul> + </div> </div> <SelectTeamModal diff --git a/web/react/components/admin_console/email_settings.jsx b/web/react/components/admin_console/email_settings.jsx index 762a4ab26..3432f69ff 100644 --- a/web/react/components/admin_console/email_settings.jsx +++ b/web/react/components/admin_console/email_settings.jsx @@ -437,7 +437,7 @@ export default class EmailSettings extends React.Component { </select> <div className='help-text'> <table - className='table-bordered' + className='table table-bordered' cellPadding='5' > <tr><td className='help-text'>{'None'}</td><td className='help-text'>{'Mattermost will send email over an unsecure connection.'}</td></tr> @@ -447,7 +447,7 @@ export default class EmailSettings extends React.Component { </div> <div className='help-text'> <button - className='help-link' + className='btn' onClick={this.handleTestConnection} disabled={!this.state.sendEmailNotifications} id='connection-button' @@ -482,7 +482,7 @@ export default class EmailSettings extends React.Component { <p className='help-text'>{'32-character salt added to signing of email invites. Randomly generated on install. Click "Re-Generate" to create new salt.'}</p> <div className='help-text'> <button - className='help-link' + className='btn' onClick={this.handleGenerateInvite} disabled={!this.state.sendEmailNotifications} > @@ -513,7 +513,7 @@ export default class EmailSettings extends React.Component { <p className='help-text'>{'32-character salt added to signing of password reset emails. Randomly generated on install. Click "Re-Generate" to create new salt.'}</p> <div className='help-text'> <button - className='help-link' + className='btn' onClick={this.handleGenerateReset} disabled={!this.state.sendEmailNotifications} > diff --git a/web/react/components/admin_console/image_settings.jsx b/web/react/components/admin_console/image_settings.jsx index e52f516e8..e08d39ca8 100644 --- a/web/react/components/admin_console/image_settings.jsx +++ b/web/react/components/admin_console/image_settings.jsx @@ -460,7 +460,7 @@ export default class FileSettings extends React.Component { <p className='help-text'>{'32-character salt added to signing of public image links. Randomly generated on install. Click "Re-Generate" to create new salt.'}</p> <div className='help-text'> <button - className='help-link' + className='btn btn-default' onClick={this.handleGenerate} > {'Re-Generate'} diff --git a/web/react/components/admin_console/log_settings.jsx b/web/react/components/admin_console/log_settings.jsx index 1c39c60e8..608ef9cc0 100644 --- a/web/react/components/admin_console/log_settings.jsx +++ b/web/react/components/admin_console/log_settings.jsx @@ -253,7 +253,7 @@ export default class LogSettings extends React.Component { {'Format of log message output. If blank will be set to "[%D %T] [%L] %M", where:'} <div className='help-text'> <table - className='table-bordered' + className='table table-bordered' cellPadding='5' > <tr><td className='help-text'>{'%T'}</td><td className='help-text'>{'Time (15:04:05 MST)'}</td></tr> diff --git a/web/react/components/admin_console/user_item.jsx b/web/react/components/admin_console/user_item.jsx index 32812e875..c5c6e19d4 100644 --- a/web/react/components/admin_console/user_item.jsx +++ b/web/react/components/admin_console/user_item.jsx @@ -127,7 +127,6 @@ export default class UserItem extends React.Component { if (user.delete_at > 0) { currentRoles = 'Inactive'; - currentRoles = 'Inactive'; showMakeMember = false; showMakeAdmin = false; showMakeSystemAdmin = false; diff --git a/web/react/components/channel_notifications.jsx b/web/react/components/channel_notifications.jsx index fed8e789e..ed76b7bce 100644 --- a/web/react/components/channel_notifications.jsx +++ b/web/react/components/channel_notifications.jsx @@ -195,9 +195,7 @@ export default class ChannelNotifications extends React.Component { const extraInfo = ( <span> - {'Selecting an option other than "Default" will override the global notification settings.'} - <br/> - {'Desktop notifications are available on Firefox, Safari, and Chrome.'} + {'Selecting an option other than "Default" will override the global notification settings. Desktop notifications are available on Firefox, Safari, and Chrome.'} </span> ); diff --git a/web/react/components/email_verify.jsx b/web/react/components/email_verify.jsx index 8d3f15525..391de3326 100644 --- a/web/react/components/email_verify.jsx +++ b/web/react/components/email_verify.jsx @@ -38,8 +38,8 @@ export default class EmailVerify extends React.Component { } return ( - <div className='col-sm-offset-4 col-sm-4'> - <div className='panel panel-default'> + <div className='col-sm-12'> + <div className='panel panel-default verify_panel'> <div className='panel-heading'> <h3 className='panel-title'>{title}</h3> </div> diff --git a/web/react/components/get_link_modal.jsx b/web/react/components/get_link_modal.jsx index 1d4aac3e6..6e0728862 100644 --- a/web/react/components/get_link_modal.jsx +++ b/web/react/components/get_link_modal.jsx @@ -23,7 +23,7 @@ export default class GetLinkModal extends React.Component { componentDidMount() { if (this.refs.modal) { $(React.findDOMNode(this.refs.modal)).on('show.bs.modal', this.onShow); - $(React.findDOMNode(this.refs.modal)).on('hide.bs.modal', this.onShow); + $(React.findDOMNode(this.refs.modal)).on('hide.bs.modal', this.onHide); } } handleClick() { @@ -43,8 +43,23 @@ export default class GetLinkModal extends React.Component { } render() { var currentUser = UserStore.getCurrentUser(); - var copyLinkConfirm = null; + let copyLink = null; + if (document.queryCommandSupported('copy')) { + copyLink = ( + <button + data-copy-btn='true' + type='button' + className='btn btn-primary pull-left' + onClick={this.handleClick} + data-clipboard-text={this.state.value} + > + Copy Link + </button> + ); + } + + var copyLinkConfirm = null; if (this.state.copiedLink) { copyLinkConfirm = <p className='alert alert-success copy-link-confirm'><i className='fa fa-check'></i> Link copied to clipboard.</p>; } @@ -98,15 +113,7 @@ export default class GetLinkModal extends React.Component { > Close </button> - <button - data-copy-btn='true' - type='button' - className='btn btn-primary pull-left' - onClick={this.handleClick} - data-clipboard-text={this.state.value} - > - Copy Link - </button> + {copyLink} {copyLinkConfirm} </div> </div> diff --git a/web/react/components/login.jsx b/web/react/components/login.jsx index 70f7a5d6e..54df75cbc 100644 --- a/web/react/components/login.jsx +++ b/web/react/components/login.jsx @@ -112,6 +112,17 @@ export default class Login extends React.Component { errorClass = ' has-error'; } + const verifiedParam = Utils.getUrlParameter('verified'); + let verifiedBox = ''; + if (verifiedParam) { + verifiedBox = ( + <div className='alert alert-success'> + <i className='fa fa-check' /> + {' Email Verified'} + </div> + ); + } + let emailSignup; if (global.window.config.EnableSignUpWithEmail === 'true') { emailSignup = ( @@ -175,6 +186,7 @@ export default class Login extends React.Component { <h2 className='signup-team__name'>{teamDisplayName}</h2> <h2 className='signup-team__subdomain'>on {global.window.config.SiteName}</h2> <form onSubmit={this.handleSubmit}> + {verifiedBox} <div className={'form-group' + errorClass}> {serverError} </div> diff --git a/web/react/components/member_list_team_item.jsx b/web/react/components/member_list_team_item.jsx index b7e81f843..629fb2ec4 100644 --- a/web/react/components/member_list_team_item.jsx +++ b/web/react/components/member_list_team_item.jsx @@ -24,32 +24,32 @@ export default class MemberListTeamItem extends React.Component { }; Client.updateRoles(data, - function handleMakeMemberSuccess() { + () => { AsyncClient.getProfiles(); }, - function handleMakeMemberError(err) { + (err) => { this.setState({serverError: err.message}); - }.bind(this) + } ); } handleMakeActive() { Client.updateActive(this.props.user.id, true, - function handleMakeActiveSuccess() { + () => { AsyncClient.getProfiles(); }, - function handleMakeActiveError(err) { + (err) => { this.setState({serverError: err.message}); - }.bind(this) + } ); } handleMakeNotActive() { Client.updateActive(this.props.user.id, false, - function handleMakeNotActiveSuccess() { + () => { AsyncClient.getProfiles(); }, - function handleMakeNotActiveError(err) { + (err) => { this.setState({serverError: err.message}); - }.bind(this) + } ); } handleMakeAdmin() { @@ -59,12 +59,12 @@ export default class MemberListTeamItem extends React.Component { }; Client.updateRoles(data, - function handleMakeAdminSuccess() { + () => { AsyncClient.getProfiles(); }, - function handleMakeAdmitError(err) { + (err) => { this.setState({serverError: err.message}); - }.bind(this) + } ); } render() { @@ -82,14 +82,18 @@ export default class MemberListTeamItem extends React.Component { const timestamp = UserStore.getCurrentUser().update_at; if (user.roles.length > 0) { - currentRoles = user.roles.charAt(0).toUpperCase() + user.roles.slice(1); + if (user.roles.indexOf('system_admin') > -1) { + currentRoles = 'System Admin'; + } else { + currentRoles = user.roles.charAt(0).toUpperCase() + user.roles.slice(1); + } } const email = user.email; - let showMakeMember = user.roles === 'admin'; - let showMakeAdmin = user.roles === ''; + let showMakeMember = user.roles === 'admin' || user.roles === 'system_admin'; + let showMakeAdmin = user.roles === '' || user.roles === 'system_admin'; let showMakeActive = false; - let showMakeNotActive = true; + let showMakeNotActive = user.roles !== 'system_admin'; if (user.delete_at > 0) { currentRoles = 'Inactive'; @@ -108,7 +112,7 @@ export default class MemberListTeamItem extends React.Component { href='#' onClick={this.handleMakeAdmin} > - Make Admin + {'Make Admin'} </a> </li> ); @@ -123,7 +127,7 @@ export default class MemberListTeamItem extends React.Component { href='#' onClick={this.handleMakeMember} > - Make Member + {'Make Member'} </a> </li> ); @@ -138,7 +142,7 @@ export default class MemberListTeamItem extends React.Component { href='#' onClick={this.handleMakeActive} > - Make Active + {'Make Active'} </a> </li> ); @@ -153,7 +157,7 @@ export default class MemberListTeamItem extends React.Component { href='#' onClick={this.handleMakeNotActive} > - Make Inactive + {'Make Inactive'} </a> </li> ); diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx index 78057d10b..30c4e94ae 100644 --- a/web/react/components/navbar_dropdown.jsx +++ b/web/react/components/navbar_dropdown.jsx @@ -135,30 +135,35 @@ export default class NavbarDropdown extends React.Component { var teams = []; - teams.push( - <li - className='divider' - key='div' - > - </li> - ); - if (this.state.teams.length > 1) { + teams.push( + <li + className='divider' + key='div' + > + </li> + ); + this.state.teams.forEach((teamName) => { if (teamName !== this.props.teamName) { teams.push(<li key={teamName}><a href={Utils.getWindowLocationOrigin() + '/' + teamName}>{'Switch to ' + teamName}</a></li>); } }); } - teams.push(<li key='newTeam_li'> - <a - key='newTeam_a' - target='_blank' - href={Utils.getWindowLocationOrigin() + '/signup_team'} - > - {'Create a New Team'} - </a> - </li>); + + if (global.window.config.EnableTeamCreation === 'true') { + teams.push( + <li key='newTeam_li'> + <a + key='newTeam_a' + target='_blank' + href={Utils.getWindowLocationOrigin() + '/signup_team'} + > + {'Create a New Team'} + </a> + </li> + ); + } return ( <ul className='nav navbar-nav navbar-right'> diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx index 6cfd243de..1d94cab47 100644 --- a/web/react/components/post_body.jsx +++ b/web/react/components/post_body.jsx @@ -215,7 +215,7 @@ export default class PostBody extends React.Component { comment = ( <p className='post-link'> <span> - {'Commented on '}{name}{apostrophe}{' message:'} + {'Commented on '}{name}{apostrophe}{' message: '} <a className='theme' onClick={this.props.handleCommentClick} diff --git a/web/react/components/post_info.jsx b/web/react/components/post_info.jsx index dba75ac5f..c1e8979a4 100644 --- a/web/react/components/post_info.jsx +++ b/web/react/components/post_info.jsx @@ -13,12 +13,6 @@ export default class PostInfo extends React.Component { super(props); this.state = {}; } - shouldShowComment(state, type, isOwner) { - if (state === Constants.POST_FAILED || state === Constants.POST_LOADING) { - return false; - } - return isOwner || (this.props.allowReply === 'true' && type !== 'Comment'); - } createDropdown() { var post = this.props.post; var isOwner = UserStore.getCurrentId() === post.user_id; @@ -33,10 +27,6 @@ export default class PostInfo extends React.Component { type = 'Comment'; } - if (!this.shouldShowComment(post.state, type, isOwner)) { - return ''; - } - var dropdownContents = []; var dataComments = 0; if (type === 'Post') { @@ -106,6 +96,10 @@ export default class PostInfo extends React.Component { ); } + if (dropdownContents.length === 0) { + return ''; + } + return ( <div> <a diff --git a/web/react/components/rhs_comment.jsx b/web/react/components/rhs_comment.jsx index 5b4694eb1..aa355f8cc 100644 --- a/web/react/components/rhs_comment.jsx +++ b/web/react/components/rhs_comment.jsx @@ -70,19 +70,84 @@ export default class RhsComment extends React.Component { componentDidUpdate() { this.parseEmojis(); } - render() { + createDropdown() { var post = this.props.post; - var currentUserCss = ''; - if (UserStore.getCurrentId() === post.user_id) { - currentUserCss = 'current--user'; + if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING || post.state === Constants.POST_DELETED) { + return ''; } var isOwner = UserStore.getCurrentId() === post.user_id; + var isAdmin = Utils.isAdmin(UserStore.getCurrentUser().roles); + + var dropdownContents = []; + + if (isOwner) { + dropdownContents.push( + <li role='presentation'> + <a + href='#' + role='menuitem' + data-toggle='modal' + data-target='#edit_post' + data-title='Comment' + data-message={post.message} + data-postid={post.id} + data-channelid={post.channel_id} + > + Edit + </a> + </li> + ); + } - var type = 'Post'; - if (post.root_id.length > 0) { - type = 'Comment'; + if (isOwner || isAdmin) { + dropdownContents.push( + <li role='presentation'> + <a + href='#' + role='menuitem' + data-toggle='modal' + data-target='#delete_post' + data-title='Comment' + data-postid={post.id} + data-channelid={post.channel_id} + data-comments={0} + > + Delete + </a> + </li> + ); + } + + if (dropdownContents.length === 0) { + return ''; + } + + return ( + <div className='dropdown'> + <a + href='#' + className='dropdown-toggle theme' + type='button' + data-toggle='dropdown' + aria-expanded='false' + /> + <ul + className='dropdown-menu' + role='menu' + > + {dropdownContents} + </ul> + </div> + ); + } + render() { + var post = this.props.post; + + var currentUserCss = ''; + if (UserStore.getCurrentId() === post.user_id) { + currentUserCss = 'current--user'; } var timestamp = UserStore.getCurrentUser().update_at; @@ -110,53 +175,7 @@ export default class RhsComment extends React.Component { ); } - var ownerOptions; - if (isOwner && post.state !== Constants.POST_FAILED && post.state !== Constants.POST_LOADING) { - ownerOptions = ( - <div className='dropdown'> - <a - href='#' - className='dropdown-toggle theme' - type='button' - data-toggle='dropdown' - aria-expanded='false' - /> - <ul - className='dropdown-menu' - role='menu' - > - <li role='presentation'> - <a - href='#' - role='menuitem' - data-toggle='modal' - data-target='#edit_post' - data-title={type} - data-message={post.message} - data-postid={post.id} - data-channelid={post.channel_id} - > - Edit - </a> - </li> - <li role='presentation'> - <a - href='#' - role='menuitem' - data-toggle='modal' - data-target='#delete_post' - data-title={type} - data-postid={post.id} - data-channelid={post.channel_id} - data-comments={0} - > - Delete - </a> - </li> - </ul> - </div> - ); - } + var dropdown = this.createDropdown(); var fileAttachment; if (post.filenames && post.filenames.length > 0) { @@ -190,7 +209,7 @@ export default class RhsComment extends React.Component { </time> </li> <li className='post-header-col post-header__reply'> - {ownerOptions} + {dropdown} </li> </ul> <div className='post-body'> diff --git a/web/react/components/user_settings/import_theme_modal.jsx b/web/react/components/user_settings/import_theme_modal.jsx index 4e8ee03fa..3301c6596 100644 --- a/web/react/components/user_settings/import_theme_modal.jsx +++ b/web/react/components/user_settings/import_theme_modal.jsx @@ -49,7 +49,6 @@ export default class ImportThemeModal extends React.Component { theme.sidebarText = colors[5]; theme.sidebarUnreadText = colors[5]; theme.sidebarTextHoverBg = colors[4]; - theme.sidebarTextHoverColor = colors[5]; theme.sidebarTextActiveBg = colors[2]; theme.sidebarTextActiveColor = colors[3]; theme.sidebarHeaderBg = colors[1]; diff --git a/web/react/components/user_settings/user_settings_appearance.jsx b/web/react/components/user_settings/user_settings_appearance.jsx index c4a137ed8..be6cf1f42 100644 --- a/web/react/components/user_settings/user_settings_appearance.jsx +++ b/web/react/components/user_settings/user_settings_appearance.jsx @@ -214,14 +214,14 @@ export default class UserSettingsAppearance extends React.Component { <div className='divider-dark first'/> {themeUI} <div className='divider-dark'/> + <br/> + <a + className='theme' + onClick={this.handleImportModal} + > + {'Import theme colors from Slack'} + </a> </div> - <br/> - <a - className='theme' - onClick={this.handleImportModal} - > - {'Import theme colors from Slack'} - </a> </div> ); } diff --git a/web/react/stores/browser_store.jsx b/web/react/stores/browser_store.jsx index e45d3d981..27a74fb2b 100644 --- a/web/react/stores/browser_store.jsx +++ b/web/react/stores/browser_store.jsx @@ -41,7 +41,13 @@ class BrowserStoreClass { } setGlobalItem(name, value) { - localStorage.setItem(name, JSON.stringify(value)); + try { + localStorage.setItem(name, JSON.stringify(value)); + } catch (err) { + console.log('An error occurred while setting local storage, clearing all props'); //eslint-disable-line no-console + localStorage.clear(); + window.location.href = window.location.href; + } } getGlobalItem(name, defaultValue) { diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index aba63b91c..8fd0ab79b 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -122,10 +122,9 @@ module.exports = { default: { type: 'Mattermost', sidebarBg: '#fafafa', - sidebarText: '#999999', + sidebarText: '#333333', sidebarUnreadText: '#333333', sidebarTextHoverBg: '#e6f2fa', - sidebarTextHoverColor: '#999999', sidebarTextActiveBg: '#e1e1e1', sidebarTextActiveColor: '#111111', sidebarHeaderBg: '#2389d7', @@ -139,15 +138,15 @@ module.exports = { linkColor: '#2389d7', buttonBg: '#2389d7', buttonColor: '#FFFFFF', - mentionHighlightBg: '#fff2bb' + mentionHighlightBg: '#fff2bb', + mentionHighlightLink: '#2f81b7' }, organization: { type: 'Organization', sidebarBg: '#2071a7', - sidebarText: '#bfcde8', + sidebarText: '#fff', sidebarUnreadText: '#fff', sidebarTextHoverBg: '#136197', - sidebarTextHoverColor: '#bfcde8', sidebarTextActiveBg: '#136197', sidebarTextActiveColor: '#FFFFFF', sidebarHeaderBg: '#2f81b7', @@ -161,15 +160,15 @@ module.exports = { linkColor: '#2f81b7', buttonBg: '#1dacfc', buttonColor: '#FFFFFF', - mentionHighlightBg: '#fff2bb' + mentionHighlightBg: '#fff2bb', + mentionHighlightLink: '#2f81b7' }, mattermostDark: { type: 'Mattermost Dark', sidebarBg: '#1B2C3E', - sidebarText: '#bbbbbb', + sidebarText: '#fff', sidebarUnreadText: '#fff', sidebarTextHoverBg: '#4A5664', - sidebarTextHoverColor: '#bbbbbb', sidebarTextActiveBg: '#39769C', sidebarTextActiveColor: '#FFFFFF', sidebarHeaderBg: '#1B2C3E', @@ -183,15 +182,15 @@ module.exports = { linkColor: '#A4FFEB', buttonBg: '#4CBBA4', buttonColor: '#FFFFFF', - mentionHighlightBg: '#338886' + mentionHighlightBg: '#984063', + mentionHighlightLink: '#A4FFEB' }, windows10: { type: 'Windows Dark', sidebarBg: '#171717', - sidebarText: '#999', + sidebarText: '#fff', sidebarUnreadText: '#fff', sidebarTextHoverBg: '#302e30', - sidebarTextHoverColor: '#999', sidebarTextActiveBg: '#484748', sidebarTextActiveColor: '#FFFFFF', sidebarHeaderBg: '#1f1f1f', @@ -205,7 +204,8 @@ module.exports = { linkColor: '#0177e7', buttonBg: '#0177e7', buttonColor: '#FFFFFF', - mentionHighlightBg: '#276198' + mentionHighlightBg: '#784098', + mentionHighlightLink: '#A4FFEB' } }, THEME_ELEMENTS: [ @@ -234,10 +234,6 @@ module.exports = { uiName: 'Sidebar Text Hover BG' }, { - id: 'sidebarTextHoverColor', - uiName: 'Sidebar Text Hover Color' - }, - { id: 'sidebarTextActiveBg', uiName: 'Sidebar Text Active BG' }, @@ -284,6 +280,10 @@ module.exports = { { id: 'mentionHighlightBg', uiName: 'Mention Highlight BG' + }, + { + id: 'mentionHighlightLink', + uiName: 'Mention Highlight Link' } ] }; diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index b51d71254..f79f3492f 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -399,9 +399,9 @@ export function applyTheme(theme) { } if (theme.sidebarText) { - changeCss('.sidebar--left .nav-pills__container li>a, .sidebar--right, .settings-modal .nav-pills>li a, .sidebar--menu', 'color:' + theme.sidebarText, 1); + changeCss('.sidebar--left .nav-pills__container li>a, .sidebar--right, .settings-modal .nav-pills>li a, .sidebar--menu', 'color:' + changeOpacity(theme.sidebarText, 0.6), 1); changeCss('@media(max-width: 768px){.settings-modal .settings-table .nav>li>a', 'color:' + theme.sidebarText, 1); - changeCss('.sidebar--left .nav-pills__container li>h4, .sidebar--left .add-channel-btn', 'color:' + changeOpacity(theme.sidebarText, 0.8), 1); + changeCss('.sidebar--left .nav-pills__container li>h4, .sidebar--left .add-channel-btn', 'color:' + changeOpacity(theme.sidebarText, 0.6), 1); changeCss('.sidebar--left .add-channel-btn:hover, .sidebar--left .add-channel-btn:focus', 'color:' + theme.sidebarText, 1); changeCss('.sidebar--left, .sidebar--right .sidebar--right__header', 'border-color:' + changeOpacity(theme.sidebarText, 0.2), 1); changeCss('.sidebar--left .status path', 'fill:' + changeOpacity(theme.sidebarText, 0.5), 1); @@ -417,17 +417,13 @@ export function applyTheme(theme) { changeCss('@media(max-width: 768px){.settings-modal .settings-table .nav>li:hover a', 'background:' + theme.sidebarTextHoverBg, 1); } - if (theme.sidebarTextHoverColor) { - changeCss('.sidebar--left .nav-pills__container li>a:hover, .sidebar--left .nav-pills__container li>a:focus, .settings-modal .nav-pills>li:hover a, .settings-modal .nav-pills>li:focus a', 'color:' + theme.sidebarTextHoverColor, 2); - changeCss('@media(max-width: 768px){.settings-modal .settings-table .nav>li:hover a', 'color:' + theme.sidebarTextHoverColor, 2); - } - if (theme.sidebarTextActiveBg) { changeCss('.sidebar--left .nav-pills__container li.active a, .sidebar--left .nav-pills__container li.active a:hover, .sidebar--left .nav-pills__container li.active a:focus, .settings-modal .nav-pills>li.active a, .settings-modal .nav-pills>li.active a:hover, .settings-modal .nav-pills>li.active a:active', 'background:' + theme.sidebarTextActiveBg, 1); } if (theme.sidebarTextActiveColor) { changeCss('.sidebar--left .nav-pills__container li.active a, .sidebar--left .nav-pills__container li.active a:hover, .sidebar--left .nav-pills__container li.active a:focus, .settings-modal .nav-pills>li.active a, .settings-modal .nav-pills>li.active a:hover, .settings-modal .nav-pills>li.active a:active', 'color:' + theme.sidebarTextActiveColor, 2); + changeCss('.sidebar--left .nav-pills__container li.active a .status .online--icon', 'fill:' + theme.sidebarTextActiveColor, 2); } if (theme.sidebarHeaderBg) { @@ -494,7 +490,7 @@ export function applyTheme(theme) { changeCss('.post-image__column a, .post-image__column a:hover, .post-image__column a:focus', 'color:' + theme.centerChannelColor, 1); changeCss('.search-bar__container .search__form .search-bar, .form-control', 'color:' + theme.centerChannelColor, 2); changeCss('@media(max-width: 768px){.search-bar__container .search__form .search-bar', 'background:' + changeOpacity(theme.centerChannelColor, 0.2) + '; color: inherit;', 1); - changeCss('.search-bar__container .search__form, .form-control', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1); + changeCss('.input-group-addon, .search-bar__container .search__form, .form-control', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1); changeCss('.form-control:focus', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.3), 1); changeCss('.channel-intro .channel-intro__content', 'background:' + changeOpacity(theme.centerChannelColor, 0.05), 1); changeCss('.date-separator .separator__text', 'color:' + theme.centerChannelColor, 2); @@ -502,7 +498,7 @@ export function applyTheme(theme) { changeCss('.modal .custom-textarea:focus', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.3), 1); changeCss('.channel-intro, .settings-modal .settings-table .settings-content .divider-dark, hr, .settings-modal .settings-table .settings-links', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1); changeCss('.post.current--user .post-body, .post.post--comment.other--root.current--user .post-comment', 'background:' + changeOpacity(theme.centerChannelColor, 0.07), 1); - changeCss('.post.current--user .post-body, .post.post--comment.other--root.current--user .post-comment, .post.post--comment.other--root .post-comment, .post.same--root .post-body, .modal .more-channel-table tbody>tr td, .member-div:first-child, .member-div', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.1), 2); + changeCss('.post.current--user .post-body, .post.post--comment.other--root.current--user .post-comment, .post.post--comment.other--root .post-comment, .post.same--root .post-body, .modal .more-channel-table tbody>tr td, .member-div:first-child, .member-div, .access-history__table .access__report, .activity-log__table', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.1), 2); changeCss('@media(max-width: 1440px){.post.same--root', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.07), 2); changeCss('@media(max-width: 1440px){.post.same--root', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.07), 2); changeCss('@media(max-width: 1800px){.inner__wrap.move--left .post.post--comment.same--root', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.07), 2); @@ -535,6 +531,10 @@ export function applyTheme(theme) { if (theme.mentionHighlightBg) { changeCss('.mention-highlight, .search-highlight', 'background:' + theme.mentionHighlightBg, 1); } + + if (theme.mentionHighlightLink) { + changeCss('.mention-highlight .mention-link', 'color:' + theme.mentionHighlightLink, 1); + } } export function changeCss(className, classValue, classRepeat) { // we need invisible container to store additional css definitions diff --git a/web/sass-files/sass/partials/_access-history.scss b/web/sass-files/sass/partials/_access-history.scss index 412a2a1d0..a3289ecc0 100644 --- a/web/sass-files/sass/partials/_access-history.scss +++ b/web/sass-files/sass/partials/_access-history.scss @@ -24,6 +24,6 @@ font-size: 15px; } .report__info { - color: #999; + @include opacity(0.8); } }
\ No newline at end of file diff --git a/web/sass-files/sass/partials/_activity-log.scss b/web/sass-files/sass/partials/_activity-log.scss index 3f0c3090d..2fb37a3bb 100644 --- a/web/sass-files/sass/partials/_activity-log.scss +++ b/web/sass-files/sass/partials/_activity-log.scss @@ -1,3 +1,20 @@ +@keyframes highlight { + from { background: rgba(yellow, 0.5);} + to { background: none;} +} + +.animation--highlight { + &:before { + content: ''; + animation: highlight 1.5s ease; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + } +} + .activity-log__table { display: table; width: 100%; @@ -26,7 +43,7 @@ } } .report__info { - color: #999; + @include opacity(0.8); } } .session-help-text { diff --git a/web/sass-files/sass/partials/_admin-console.scss b/web/sass-files/sass/partials/_admin-console.scss index 5037da415..09907da6d 100644 --- a/web/sass-files/sass/partials/_admin-console.scss +++ b/web/sass-files/sass/partials/_admin-console.scss @@ -1,193 +1,202 @@ - -.sidebar--left { &.sidebar--collapsable { - background: #333; - .team__header { - background: transparent; - margin-bottom: 5px; - } - .nav { - li { - padding: 0; - .icon { - width: 17px; - } - > a { - color: #fff; - padding: 9px 15px; - display: block; - &:hover, &.active, &:focus { - background-color: $primary-color; - } - } - > h4 { - background: #333; - padding: 10px 10px; - margin: 1px 0 0; - } - } - .menu-icon--right { - vertical-align: top; - padding: 5px 10px; - margin: -5px; - float: right; - .fa { - font-size: 13px; - right: -2px; - position: relative; - color: #fff; - } +#admin_controller { + > div { + height: 100%; + } + .table { + background: #fff; + } + .sidebar--left { + &.sidebar--collapsable { + background: #333; + .team__header { + background: transparent; + margin-bottom: 5px; } - &.nav__sub-menu { - background: #111; - -webkit-font-smoothing: auto; - &.padded { - padding: 5px 0; - } + .nav { li { + padding: 0; + .icon { + width: 17px; + } > a { - font-size: 13px; - padding: 5px 15px; - background: transparent; - color: #bbb; - &:hover { - color: lighten($primary-color, 10); - } - &.active { - color: #fff; - font-weight: 600; + padding: 9px 15px; + display: block; + &:hover, &.active, &:focus { + background-color: #EAEAEA; } } - .nav-more { + > h4 { + background: #333; + padding: 10px 10px; + margin: 1px 0 0; + } + } + .menu-icon--right { + vertical-align: top; + padding: 5px 10px; + margin: -5px; + float: right; + .fa { font-size: 13px; - padding: 5px 15px; - background: transparent; - color: #bbb; - display: block; - cursor: pointer; - &:hover { - color: lighten($primary-color, 10); + right: -2px; + position: relative; + color: #fff; + } + } + &.nav__sub-menu { + background: #111; + -webkit-font-smoothing: auto; + &.padded { + padding: 5px 0; + } + li { + > a { + font-size: 13px; + padding: 5px 15px; + background: transparent; + color: #bbb; + &:hover { + color: lighten($primary-color, 10); + } + &.active { + color: #fff; + font-weight: 600; + } + } + .nav-more { + font-size: 13px; + padding: 5px 15px; + background: transparent; + color: #bbb; + display: block; + cursor: pointer; + &:hover { + color: lighten($primary-color, 10); + } } } } - } - &.nav__inner-menu { - li { - > a { - padding-left: 20px; + &.nav__inner-menu { + li { + > a { + padding-left: 20px; + } } } } } } -} -.log__panel { - overflow: scroll; - width: 100%; - height: 800px; - border: 1px solid #ddd; - margin-top: 10px; - padding: 5px; - background-color: white; -} - -.app__content { - &.admin { - overflow: auto; - background-color: #f1f1f1; - padding: 0 20px 20px; - min-height: 600px; - } - .wrapper--fixed { - max-width: 800px; + .log__panel { + overflow: scroll; + width: 100%; + height: 800px; + border: 1px solid #ddd; + margin-top: 10px; + padding: 5px; + background-color: white; } - .form-horizontal { - margin-top: 40px; - .control-label { - text-align: left; - padding-right: 0; - font-weight: 600; + + .app__content { + &.admin { + overflow: auto; + background-color: #f1f1f1; + padding: 0 20px 20px; + min-height: 600px; } - .form-group { - margin-bottom: 25px; + .wrapper--fixed { + max-width: 800px; } - .help-text { - margin: 10px 0 0 15px; - color: #777; - .help-link { - margin-right: 5px; + .form-horizontal { + margin-top: 40px; + .control-label { + text-align: left; + padding-right: 0; + font-weight: 600; } - .btn { - font-size: 13px; + .form-group { + margin-bottom: 25px; + } + .help-text { + margin: 10px 0 0 15px; + color: #777; + .help-link { + margin-right: 5px; + } + .btn { + font-size: 13px; + } + } + .alert { + display: inline-block; + padding: 5px 7px; + margin: 1em 0 0; + top: 1px; + position: relative; + .fa { + margin-right: 5px; + } } } - .alert { - display: inline-block; - padding: 5px 7px; - margin: 0; - top: 1px; - position: relative; - } - } - .banner { - background: #fff; - border: 1px solid #ddd; - padding: 0.7em 1.5em; - font-size: 0.95em; - margin: 2em 0; - .banner__heading { - font-size: 1.5em; + .banner { + background: #fff; + border: 1px solid #ddd; + padding: 0.7em 1.5em; + font-size: 0.95em; + margin: 2em 0; + .banner__heading { + font-size: 1.5em; + } + .banner__content { + width: 80%; + } } - .banner__content { - width: 80%; + .popover { + border-radius: 3px; + width: 100%; + font-size: 0.95em; } - } - .popover { - border-radius: 3px; - width: 100%; - font-size: 0.95em; - } - .panel { - border: none; - background-color: transparent; - } - .panel-default { - > .panel-heading { - padding: 10px 0; + .panel { + border: none; background-color: transparent; } - .panel-body { - padding: 30px 0 10px; + .panel-default { + > .panel-heading { + padding: 10px 0; + background-color: transparent; + } + .panel-body { + padding: 30px 0 10px; + } + } + .panel-group { + margin-bottom: 50px; } - } - .panel-group { - margin-bottom: 50px; - } - .panel-title { - font-size: 24px; - line-height: 1.5; - a { - text-decoration: none; - display: block; - @include clearfix; - &.collapsed { - .fa-minus { - display: none; + .panel-title { + font-size: 24px; + line-height: 1.5; + a { + text-decoration: none; + display: block; + @include clearfix; + &.collapsed { + .fa-minus { + display: none; + } + .fa-plus { + display: inline-block; + } + } + .fa { + font-size: 18px; + float: right; + margin-top: 8px; + color: #aaa; } .fa-plus { - display: inline-block; + display: none; } } - .fa { - font-size: 18px; - float: right; - margin-top: 8px; - color: #aaa; - } - .fa-plus { - display: none; - } } } - }
\ No newline at end of file diff --git a/web/sass-files/sass/partials/_base.scss b/web/sass-files/sass/partials/_base.scss index 4237ee1fa..18462d92a 100644 --- a/web/sass-files/sass/partials/_base.scss +++ b/web/sass-files/sass/partials/_base.scss @@ -34,6 +34,10 @@ body { } } +.input-group-addon { + background: transparent; +} + .popover { color: #333; &.bottom { diff --git a/web/sass-files/sass/partials/_headers.scss b/web/sass-files/sass/partials/_headers.scss index 2a4e82fc7..8e353aff9 100644 --- a/web/sass-files/sass/partials/_headers.scss +++ b/web/sass-files/sass/partials/_headers.scss @@ -37,7 +37,6 @@ &.description { overflow: hidden; text-overflow: ellipsis; - @include opacity(0.6); margin-top: 2px; max-height: 45px; } diff --git a/web/sass-files/sass/partials/_mentions.scss b/web/sass-files/sass/partials/_mentions.scss index fb74eb4f5..f59cefbc6 100644 --- a/web/sass-files/sass/partials/_mentions.scss +++ b/web/sass-files/sass/partials/_mentions.scss @@ -57,11 +57,4 @@ .mention-highlight { background-color:#fff2bb; - a { - color: inherit; - text-decoration: underline; - &:hover, &:active { - color: inherit; - } - } }
\ No newline at end of file diff --git a/web/sass-files/sass/partials/_post.scss b/web/sass-files/sass/partials/_post.scss index 8bf4b0534..19cfdc050 100644 --- a/web/sass-files/sass/partials/_post.scss +++ b/web/sass-files/sass/partials/_post.scss @@ -257,7 +257,7 @@ body.ios { line-height: 18px; display: inline-block; font-size: 13px; - @include opacity(0.6); + @include opacity(0.7); } } } diff --git a/web/sass-files/sass/partials/_post_right.scss b/web/sass-files/sass/partials/_post_right.scss index da5bcbad2..e4860b286 100644 --- a/web/sass-files/sass/partials/_post_right.scss +++ b/web/sass-files/sass/partials/_post_right.scss @@ -29,7 +29,7 @@ min-height: 100px; } .msg-typing { - color: #555; + @include opacity(0.7); float: left; padding-top: 17px; } diff --git a/web/sass-files/sass/partials/_search.scss b/web/sass-files/sass/partials/_search.scss index a7b1ab190..2de1b5380 100644 --- a/web/sass-files/sass/partials/_search.scss +++ b/web/sass-files/sass/partials/_search.scss @@ -106,11 +106,4 @@ .search-highlight { background-color: #FFF2BB; - a { - color: inherit; - text-decoration: underline; - &:hover, &:active { - color: inherit; - } - } } diff --git a/web/sass-files/sass/partials/_signup.scss b/web/sass-files/sass/partials/_signup.scss index 47235eb50..fcf0d5d77 100644 --- a/web/sass-files/sass/partials/_signup.scss +++ b/web/sass-files/sass/partials/_signup.scss @@ -333,3 +333,8 @@ .authorize-btn { margin-right: 6px; } + +.verify_panel { + margin: 60px auto auto auto; + max-width: 380px; +} diff --git a/web/templates/admin_console.html b/web/templates/admin_console.html index 1444d9b17..a046478f6 100644 --- a/web/templates/admin_console.html +++ b/web/templates/admin_console.html @@ -5,15 +5,15 @@ {{template "head" . }} <body> -<div id="error_bar"></div> +<div id='error_bar'></div> -<div id="admin_controller"></div> +<div id='admin_controller' class='container-fluid'></div> -<div id="select_team_modal"></div> +<div id='select_team_modal'></div> <script> window.setup_admin_console_page(); - + $(document).ready(function(){ $('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="popover"]').popover(); diff --git a/web/templates/verify.html b/web/templates/verify.html index cb4832512..a49ba7930 100644 --- a/web/templates/verify.html +++ b/web/templates/verify.html @@ -1,16 +1,21 @@ {{define "verify"}} <!DOCTYPE html> <html> -{{template "head" . }} -<body> - <div class="container-fluid"> - <div class="row"> - <div id="verify"></div> + {{template "head" . }} + <body class="white"> + <div class="container-fluid"> + <div class="inner__wrap"> + <div class="row content"> + <div id="verify"></div> + </div> + <div class="row footer"> + {{template "footer" . }} + </div> + </div> </div> - </div> - <script> - window.setupVerifyPage({{ .Props }}); - </script> -</body> + <script> + window.setupVerifyPage({{ .Props }}); + </script> + </body> </html> {{end}} diff --git a/web/web.go b/web/web.go index a1bbf5a81..b87636187 100644 --- a/web/web.go +++ b/web/web.go @@ -422,24 +422,17 @@ func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) { } } - var isVerified string - if len(userId) != 26 { - isVerified = "false" - } else if len(hashedId) == 0 { - isVerified = "false" - } else if model.ComparePassword(hashedId, userId) { - isVerified = "true" + if len(userId) == 26 && len(hashedId) != 0 && model.ComparePassword(hashedId, userId) { if c.Err = (<-api.Srv.Store.User().VerifyEmail(userId)).Err; c.Err != nil { return } else { - c.LogAudit("") + c.LogAudit("Email Verified") + http.Redirect(w, r, api.GetProtocol(r)+"://"+r.Host+"/"+name+"/login?verified=true&email="+email, http.StatusTemporaryRedirect) + return } - } else { - isVerified = "false" } page := NewHtmlTemplatePage("verify", "Email Verified") - page.Props["IsVerified"] = isVerified page.Props["TeamURL"] = c.GetTeamURLFromTeam(team) page.Props["UserEmail"] = email page.Props["ResendSuccess"] = resendSuccess |