Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LoginController < ApplicationController
- def index
- render :action=>"login_form"
- end
- def login_form
- end
- def login_auth
- @login_creds = params["login"]
- @username = @login_creds["username"]
- @password = @login_creds["password"]
- #our initial connection is done as admin, to look up the dn of the email address entered at login_form
- @admin_connection = LdapConnection.login($admin_dn,$admin_pass)
- if @admin_connection
- @user_dn = LdapConnection.find(:attribute=>"uid",:value=>@username).dn
- end
- if School.login(@user_dn,@password)
- flash[:notice]="Successful login"
- redirect_to :controller=>"main",:action=>"welcome"
- else
- flash[:notice]="Couldn't log in"
- redirect_to :controller=>"login",:action=>"login_form"
- end
- end
- def logged_in
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement