Merge pull request #938 from mattermost/plt-111
PLT-111 Combining email verification confirmation screen with login screen.
Этот коммит содержится в:
@@ -38,8 +38,8 @@ export default class EmailVerify extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='col-sm-offset-4 col-sm-4'>
|
<div className='col-sm-12'>
|
||||||
<div className='panel panel-default'>
|
<div className='panel panel-default verify_panel'>
|
||||||
<div className='panel-heading'>
|
<div className='panel-heading'>
|
||||||
<h3 className='panel-title'>{title}</h3>
|
<h3 className='panel-title'>{title}</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -112,6 +112,17 @@ export default class Login extends React.Component {
|
|||||||
errorClass = ' has-error';
|
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;
|
let emailSignup;
|
||||||
if (global.window.config.EnableSignUpWithEmail === 'true') {
|
if (global.window.config.EnableSignUpWithEmail === 'true') {
|
||||||
emailSignup = (
|
emailSignup = (
|
||||||
@@ -175,6 +186,7 @@ export default class Login extends React.Component {
|
|||||||
<h2 className='signup-team__name'>{teamDisplayName}</h2>
|
<h2 className='signup-team__name'>{teamDisplayName}</h2>
|
||||||
<h2 className='signup-team__subdomain'>on {global.window.config.SiteName}</h2>
|
<h2 className='signup-team__subdomain'>on {global.window.config.SiteName}</h2>
|
||||||
<form onSubmit={this.handleSubmit}>
|
<form onSubmit={this.handleSubmit}>
|
||||||
|
{verifiedBox}
|
||||||
<div className={'form-group' + errorClass}>
|
<div className={'form-group' + errorClass}>
|
||||||
{serverError}
|
{serverError}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -333,3 +333,8 @@
|
|||||||
.authorize-btn {
|
.authorize-btn {
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.verify_panel {
|
||||||
|
margin: 60px auto auto auto;
|
||||||
|
max-width: 380px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
{{define "verify"}}
|
{{define "verify"}}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
{{template "head" . }}
|
{{template "head" . }}
|
||||||
<body>
|
<body class="white">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="inner__wrap">
|
||||||
<div id="verify"></div>
|
<div class="row content">
|
||||||
|
<div id="verify"></div>
|
||||||
|
</div>
|
||||||
|
<div class="row footer">
|
||||||
|
{{template "footer" . }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<script>
|
||||||
<script>
|
window.setupVerifyPage({{ .Props }});
|
||||||
window.setupVerifyPage({{ .Props }});
|
</script>
|
||||||
</script>
|
</body>
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
15
web/web.go
15
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 && len(hashedId) != 0 && model.ComparePassword(hashedId, userId) {
|
||||||
if len(userId) != 26 {
|
|
||||||
isVerified = "false"
|
|
||||||
} else if len(hashedId) == 0 {
|
|
||||||
isVerified = "false"
|
|
||||||
} else if model.ComparePassword(hashedId, userId) {
|
|
||||||
isVerified = "true"
|
|
||||||
if c.Err = (<-api.Srv.Store.User().VerifyEmail(userId)).Err; c.Err != nil {
|
if c.Err = (<-api.Srv.Store.User().VerifyEmail(userId)).Err; c.Err != nil {
|
||||||
return
|
return
|
||||||
} else {
|
} 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 := NewHtmlTemplatePage("verify", "Email Verified")
|
||||||
page.Props["IsVerified"] = isVerified
|
|
||||||
page.Props["TeamURL"] = c.GetTeamURLFromTeam(team)
|
page.Props["TeamURL"] = c.GetTeamURLFromTeam(team)
|
||||||
page.Props["UserEmail"] = email
|
page.Props["UserEmail"] = email
|
||||||
page.Props["ResendSuccess"] = resendSuccess
|
page.Props["ResendSuccess"] = resendSuccess
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user