Advertisement
Guest User

Untitled

a guest
Jul 31st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. class LoginController < ApplicationController
  2. def index
  3. render :action=>"login_form"
  4. end
  5.  
  6. def login_form
  7. end
  8.  
  9. def login_auth
  10. @login_creds = params["login"]
  11. @username = @login_creds["username"]
  12. @password = @login_creds["password"]
  13.  
  14. #our initial connection is done as admin, to look up the dn of the email address entered at login_form
  15. @admin_connection = LdapConnection.login($admin_dn,$admin_pass)
  16. if @admin_connection
  17. @user_dn = LdapConnection.find(:attribute=>"uid",:value=>@username).dn
  18. end
  19.  
  20. if School.login(@user_dn,@password)
  21. flash[:notice]="Successful login"
  22. redirect_to :controller=>"main",:action=>"welcome"
  23. else
  24. flash[:notice]="Couldn't log in"
  25. redirect_to :controller=>"login",:action=>"login_form"
  26. end
  27. end
  28.  
  29. def logged_in
  30. end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement