Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Update lost password page design #143

Merged
merged 17 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/assets/images/arrow-back.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
@import "instances_table";
@import "file_uploader";
@import "browse";
@import "lostpassword";
@import "flatpickr/dist/themes/light";

/* Bootstrap and Font Awesome */
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/bioportal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#bd {
background: #fff;
}
#bd hr {
#bd > hr {
border:0;
height:1px;
color:#e9eaeb;
Expand Down
73 changes: 73 additions & 0 deletions app/assets/stylesheets/lostpassword.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
*{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be applied everywhere in the application, is it what you want ?

font-family: poppins;
margin: 0;
padding: 0;
}
.lost-password-form{
margin-top: 30px;
padding: 37px 41px;
box-shadow: rgba(0, 0, 0, 0.05) 0px 20px 50px;
border-radius: 14px;
}
.lost-password-arrowback{
all: none;
}
.lost-password-title{
font-size: 18px;
text-align: center;
font-weight: 700;
}
#lost-password-title-line{
width: 128px ;
margin: auto !important ;
margin-bottom: 14px !important ;
margin-top: 3px !important ;
border: 1px solid var(--primary-color) !important ;
border-radius: 5px ;
}
.lost-password-description{
color: #666666;
font-size: 12.5px;
margin-bottom: 14px;
width: 357px;
}
.lost-password-input{
box-sizing: border-box;
outline: none;
padding: 21px;
font-size: 16px;
border: 1px solid #BDBDBD;
border-radius: 9px;
width: 357px;

}
.lost-password-input:focus{
border: 1px solid var(--primary-color);
}
.lost-password-input::placeholder{
font-weight: 300;
color: #C1C1C1;
}

.lost-password-input-title{
font-size: 13px;
margin-bottom: 5px;
font-weight: 600;
color: #666666;
}
.lost-password-button{
margin-top: 20px;
width: 357px;
font-size: 16px;
color: white;
padding: 21px;
background-color: var(--primary-color);
border: none;
border-radius: 9px;
margin-bottom: 20px;
display: block;
}
.lost-password-button:hover{
background-color: var(--hover-color);
cursor: pointer;
}
6 changes: 5 additions & 1 deletion app/controllers/login_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,18 @@ def destroy
def lost_password
end

def lost_password_success
end


# Sends a new password to the user
def send_pass
username = params[:user][:account_name]
email = params[:user][:email]
resp = LinkedData::Client::HTTP.post("/users/create_reset_password_token", {username: username, email: email})

if resp.nil?
redirect_to login_index_path, notice: "Please check your email for a message with reset instructions"
redirect_to "/lost_pass_success"
else
flash[:notice] = resp.errors.first + ". Please try again."
redirect_to "/lost_pass"
Expand Down
2 changes: 1 addition & 1 deletion app/views/login/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ Errors On Form
<span style="font-size:1.2em;"><%=link_to "Lost Password", '/lost_pass'%></span><br><br>
</center>

<% end %>
<% end %>
22 changes: 0 additions & 22 deletions app/views/login/lost_password.html.erb

This file was deleted.

15 changes: 15 additions & 0 deletions app/views/login/lost_password.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
= form_for(:user , :url=>{:controller=>'login',:action=>'send_pass'}) do
.d-flex.justify-content-center.m-4
.lost-password-form
.d-flex.justify-content-between
%a{:href => "javascript:javascript:history.go(-1)"}
%img.lost-password-arrowback{:src => "#{asset_path("arrow-back.svg")}"}/
.lost-password-title-container
%h2.lost-password-title
Recover password
%hr#lost-password-title-line/
%div
%p.lost-password-description Enter the email associated with your account and we will send an email with instructions to reset your password
%p.lost-password-input-title Email
= text_field 'user', :email,class: "lost-password-input", placeholder: "Enter the email"
%input.lost-password-button{:type => "submit", :value => "Send instructions"}/
1 change: 1 addition & 0 deletions app/views/login/lost_password_success.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= render(PopupMessageComponent.new(message: "A password reset email has been sent to your email, please follow the instructions in the email to reset your password.", button_text: "back home", icon:"green-check.svg"))
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
# User
get '/logout' => 'login#destroy', :as => :logout
get '/lost_pass' => 'login#lost_password'
get '/lost_pass_success' => 'login#lost_password_success'
get '/reset_password' => 'login#reset_password'
post '/accounts/:id/custom_ontologies' => 'users#custom_ontologies', :as => :custom_ontologies
get '/login_as/:login_as' => 'login#login_as' , constraints: { login_as: /[\d\w\.\-\%\+ ]+/ }
Expand Down