Last active
September 13, 2019 22:50
-
-
Save eri-b/b9afaaf42645201c22f8d8e0eb034678 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionsController < ApplicationController | |
def create | |
site = Site.find_by(name: params[:session][:site]) | |
if site && site.authenticate(params[:session][:password]) | |
session[site.name.to_sym] = "session-unlocked" | |
redirect_to main_path(site.name), notice: 'Logged in. Free to add/delete posts' | |
else | |
flash.now[:danger] = 'Invalid password' | |
redirect_to main_path(site.name), notice: 'Incorrect password' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment