mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Merge pull request #938 from mattermost/plt-111
PLT-111 Combining email verification confirmation screen with login screen.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -333,3 +333,8 @@
|
||||
.authorize-btn {
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.verify_panel {
|
||||
margin: 60px auto auto auto;
|
||||
max-width: 380px;
|
||||
}
|
||||
|
||||
@@ -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}}
|
||||
|
||||
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 {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user